package com.xinhe.web.controller;

import com.xinhe.web.common.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.Valid;

@RestController
@RequestMapping(value = "/adapayAdress")
@Api(value = "Adapay地址", tags = "Adapay地址")
public class AdapayAddressController {


    /*@Autowired
    private IAdapayAddressService adapayAddressService;
    @ApiOperation(httpMethod = "GET", value = "分页查询adapay地址")
    @RequestMapping({"/pageAdapayAddress"})
    public PageResult<AdapayAddressView> pageAdapayAddress(AdapayAddressQuery query) {
        return this.adapayAddressService.pageAdapayAddress(query);
    }
    @ApiOperation(httpMethod = "POST", value = "保存adapay地址")
    @RequestMapping({"/saveAdapayAddress"})
    public BaseResult saveAdapayAddress(@Valid AdapayAddressModel model, BindingResult bind) {
        if (bind.hasErrors()) {
            BaseResult result = new BaseResult();
            result.setBindingResult(bind);
            return result;
        }
        return (BaseResult)this.adapayAddressService.saveModel((IdModel)model);
    }

    @ApiOperation(httpMethod = "GET", value = "删除adapay地址")
    @ApiImplicitParam(name = "adapayAddressId", value = "标识", dataTypeClass = Long.class, required = true)
    @RequestMapping({"/deleteAdapayAddress"})
    public BaseResult deleteAdapayAddress(Long adapayAddressId) {
        return this.adapayAddressService.delete(adapayAddressId);
    }

    @ApiOperation(httpMethod = "GET", value = "adapay地址详情")
    @ApiImplicitParam(name = "adapayAddressId", value = "标识", dataTypeClass = Long.class, required = true)
    @RequestMapping({"/detailAdapayAddress"})
    public BeanResult<AdapayAddress> detailAdapayAddress(Long adapayAddressId) {
        return this.adapayAddressService.findById(adapayAddressId);
    }

    @ApiOperation(httpMethod = "POST", value = "获取adapay地址")
    @PostMapping({"/getAdapayAddress"})
    public ListResult<AdapayAddress> getAdapayAddress(@RequestParam Integer type, @RequestParam Integer level, Long parentId) {
        return this.adapayAddressService.getAdapayAddress(type, level, parentId);
    }

    @ApiOperation(httpMethod = "POST", value = "读取adapt地址json文件（商户进件）")
    @PostMapping({"/readAdapayAddress"})
    public BaseResult readAdapayAddress(@RequestParam String filePath) {
        return this.adapayAddressService.readAdapayAddress(filePath);
    }

    @ApiOperation(httpMethod = "POST", value = "读取adapt地址json文件（商户入驻）")
    @PostMapping({"/readAdapayAddressResident"})
    public BaseResult readAdapayAddressResident(@RequestParam String filePath) {
        return this.adapayAddressService.readAdapayAddressResident(filePath);
    }*/
}